package com.gxc.test;

import javax.annotation.Resource;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * 多线程测试.
 *
 * @author 宫新程
 * @since 2018/12/17 12:41 AM
 */
@Service
public class AsyncService {

  @Resource private Environment environment;

  @Async
  public void executeAsycnTask(Integer i) {
    System.out.println("执行异步任务：" + i);
  }

  @Async
  public void executeAsycnTaskPlus(Integer i) {
    System.out.println("执行异步任务 + 1：" + (i + 1));
  }

  public void printSystemName() {
    String property = environment.getProperty("os.name");
    System.out.println(property);
  }

}
